package lab12;

public class Demo {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String[] TaskName = {"Dig", "Chop", "Play", "Throw", "Smash", "Walk", "Talk", "Dance", "Fence", "Sell", "Buy", "Try"};
		int[] TaskTime = {4, 6, 7, 8, 9, 12, 4, 6, 2, 25, 3, 5};
		Employee.setAllwork(new AllWork());
		AllWork allwork = Employee.getAllwork();
		for (int i = 0; i < 12; i++) {
			Task task = new Task(TaskName[i], TaskTime[i]);
			allwork.addTask(task);
		}
		Employee[] workers = new Employee[4];
		String[] employeeNames = {"Gosho", "Pesho", "Stoyan", "Petkan"};
		for (int i = 0; i < 4; i++) {
			workers[i] = new Employee(employeeNames[i]);
		}
		
		for (int i = 1; !allwork.isAllWorkDone(); i++ ) {
			System.out.println("Start of work day " + i + ".");
			for (int j = 0; j < workers.length; j++)
			{
				workers[j].startWorkingDay();
				workers[j].work();
				if (allwork.isAllWorkDone()) break;
			}
		}
		System.out.println("No more tasks!");
	}

}
